#include <iostream>
#include <cmath>
#include <mutex>
#include <vector>
using namespace std;
#define int long long

vector<int> nums; 
const int MAXN = 1000000 + 10;
const int MOD = 666623333;
int num[MAXN];
int ret[MAXN];
void func(int n) {
    vector<bool> a(n + 5, true); 
    a[0] = false;
    a[1] = false;
    for(int i = 2; i <= n; i++) {
        if(a[i]) {
            nums.push_back(i);
            for(int j = i * i; j <= n; j+=i) {
                a[j] = false;
            }
        }
    }
}
signed main() {
    int x, y;
    cin >> x >> y;
    int t = sqrt(y) + 2;
    func(t);
    for(int i = 0; i < y - x + 1; i++) {
        num[i] = i + x;
        ret[i] = i + x;
    }
    for(auto& e : nums) {
        int start = (x + e - 1) / e * e;
        for(int j = start; j <= y; j += e) {
            int temp = j - x;
            while(num[temp] % e == 0) {
                num[temp] /= e;
            } 
            ret[temp] = ret[temp] / e * (e - 1);
        }
    }
    for(int i = 0; i < y - x + 1; i++) {
        if(num[i] > 1) {
            ret[i] = ret[i] / num[i] * (num[i] - 1);
        }
    }
    int total = 0;
    int res = 0;
    if((y - x + 1) % 2 == 0) {
        total = ((x + y) % MOD) * (((y - x + 1) / 2) % MOD) % MOD;
    } else {
        total = (((x + y) / 2) % MOD) * ((y - x + 1) % MOD) % MOD;
    }
    for(int i = 0; i < y - x + 1; i++) {
        res = (res + ret[i]) % MOD;
    }
    int ans = (total - res + MOD) % MOD;
    cout << ans << endl;
    return 0;
}